<template>
  <div class="quanbubox">
    <div class="top">
      <div class="left">
        <img
          src="	https://shark2.douyucdn.cn/front-publish/m-douyu-v3-master/assets/images/icon-live_88adc06.png"
          alt=""
        />
        <span>全部直播</span>
      </div>
      <div class="rgiht" @click="quanbu()">
        <span>当前</span>
        <span>23044</span>
        <span>个直播</span>
        <span
          ><img
            src="https://shark2.douyucdn.cn/front-publish/m-douyu-v3-master/assets/images/icon-more_6c08756.png"
            alt=""
        /></span>
      </div>
    </div>
    <div class="qbContent">
      <ul class="uls">
        <li v-for="(item, i) in quanbuLisht" :key="item.cate2Id" @click="dizhi(item.rid)">
          <div class="reqi" v-if="i < 4">
            <img
              src="https://shark2.douyucdn.cn/front-publish/m-douyu-v3-master/assets/images/iconfont-wo_fdcada2.png"
              alt=""
            />
            <span>{{ item.nickname }}</span>
          </div>
          <div class="user" v-if="i < 4">
            <img
              src="https://shark2.douyucdn.cn/front-publish/m-douyu-v3-master/assets/images/hotnum_6b05e5d.png"
              alt=""
            />
            <span>{{ item.hn }}</span>
          </div>
        
          <lazy-component>
              <img  alt="" v-if="i < 4" v-lazy="item.roomSrc"/>
          </lazy-component>
          <p v-if="i < 4">{{ item.roomName }}</p>
        </li>
      </ul>
    </div>
  </div>
</template>
<script>
import { getQuanBu } from "@/api/roomList";
export default {
  data() {
    return {
      quanbuLisht: [],
    };
  },
  created() {
    this.shuju();
  },
  methods: {
    async shuju() {
      let params = {
        page: "1",
        type: "",
      };
      let res = await getQuanBu(params);
      this.quanbuLisht = res.data.list;
    },
    quanbu(){
      this.$router.push({
        name:'QeiHuan',
        query:{
          name:'全部',
          type:'',
        },
      });
    },
     dizhi(id){
     window.location.href=`https://www.douyu.com/room/share/${id}`;   
    }
  },
};
</script>

<style lang="scss" scoped>
.quanbubox {
  width: 7.8rem;
  .top {
    width: 7.8rem;
    display: flex;
    justify-content: space-between;
    margin-top: 0.8rem;
    .left {
      width: 2rem;
      display: flex;
      justify-content: space-between;
      img {
        width: 0.5rem;
        height: 0.3rem;
        margin-left: 0.1rem;
        margin-top: 0.05rem;
      }
      span {
        font-size: 0.3rem;
      }
    }
    .rgiht {
      width: 3rem;
      display: flex;
      justify-content: right;
      align-items: center;
      span {
        font-size: 0.25rem;
        margin-left: 0.05rem;
        img {
          width: 0.3rem;
          margin-top: 10px;
        }
      }
      span:nth-of-type(2) {
        color: #ff7700;
      }
    }
  }
}
.qbContent {
  width: 7.8rem;
  margin-top: 0.2rem;
  .uls {
    width: 7.8rem;
    display: flex;
    flex-wrap: wrap;
    li:nth-child(-n + 4) {
      width: 3.7rem;
      height: 2.6rem;
      margin-left: 0.1rem;
      position: relative;
      .reqi {
        position: absolute;
        bottom: 0.5rem;
        left: 0.1rem;
        img {
          width: 0.2rem;
        }
        span {
          font-size: 0.2rem;
          color: #fff;
        }
      }
      .user {
        position: absolute;
        top: 0.1rem;
        right: 0.1rem;
        img {
          width: 0.3rem;
        }
        span {
          font-size: 0.3rem;
          color: #fff;
        }
      }
      img {
        width: 100%;
      }
      p {
        font-size: 0.25rem;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
      }
    }
  }
}
</style>